<?php
	require_once('../../auth.php');

?>

<html>
<head>
<script language="javascript">
location.replace("../../adminhome.php")

</script>

</head>
<body>
<?php
/*file no 1
*/


$a=$_FILES["file"]["size"];
$b=$_FILES["file2"]["size"];
$c=$_FILES["file3"]["size"];

if(($_FILES["file"]["size"])>0)
{ 
$img="big/";
$img.=$_FILES["file"]["name"];
$img2=$_FILES["file"]["name"];
if ((($_FILES["file"]["type"] == "image/jpeg")
/*|| ($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/pjpeg")*/)
)
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("big/" . $_FILES["file"]["name"]))
      {
		  
/*     echo $_FILES["file"]["name"] . " already exists. ";
*/      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "big/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "big/" . $_FILES["file"]["name"];
	  
	
	  
	  
      }
    }



	
 }
else
  {
  echo "Invalid file";
  }
echo $a ."success";
}
?> 


<?php
/*file no 2*/


if(($_FILES["file2"]["size"])>0)
{
$img1="big/";
$img1.=$_FILES["file2"]["name"];
$img3=$_FILES["file2"]["name"];
if ((($_FILES["file2"]["type"] == "image/jpeg")
/*|| ($_FILES["file2"]["type"] == "image/gif")
|| ($_FILES["file2"]["type"] == "image/pjpeg")*/)
)
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file2"]["name"] . "<br />";
    echo "Type: " . $_FILES["file2"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file2"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file2"]["tmp_name"] . "<br />";

    if (file_exists("big/" . $_FILES["file2"]["name"]))
      {
		  
/*     echo $_FILES["file2"]["name"] . " already exists. ";
*/      }
    else
      {
      move_uploaded_file($_FILES["file2"]["tmp_name"],
      "big/" . $_FILES["file2"]["name"]);
      echo "Stored in: " . "big/" . $_FILES["file2"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
}

?> 


<?php
/*file no 3*/


if(($_FILES["file3"]["size"])>0)
{
$img4="big/";
$img4.=$_FILES["file3"]["name"];
$img5=$_FILES["file3"]["name"];
if ((($_FILES["file3"]["type"] == "image/jpeg")
/*|| ($_FILES["file3"]["type"] == "image/gif")
|| ($_FILES["file3"]["type"] == "image/pjpeg")*/)
)
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file3"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file3"]["name"] . "<br />";
    echo "Type: " . $_FILES["file3"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file3"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file3"]["tmp_name"] . "<br />";

    if (file_exists("big/" . $_FILES["file3"]["name"]))
      {
		  
/*     echo $_FILES["file3"]["name"] . " already exists. ";
*/      }
    else
      {
      move_uploaded_file($_FILES["file3"]["tmp_name"],
      "big/" . $_FILES["file3"]["name"]);
      echo "Stored in: " . "big/" . $_FILES["file3"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
}

?> 
<?php
include('../include.php');
   $image = new SimpleImage();


if($a>0)
{
$new1="thumb/";
$new1.=$img2;

   $image->load($img);
   $image->resize(245,164);
   $image->save($new1);
   
$con = mysql_connect("localhost","appma" ,"database");
	mysql_select_db("162_appma", $con);
$sql="INSERT INTO  gallery VALUES ('$img2', '$_POST[caption1]', '$_POST[date1]', '$_POST[event1]')";
mysql_query($sql,$con);   
}

if($b>0)
{

$new2="thumb/";
$new2.=$img3;

   $image->load($img1);
   $image->resize(245,164);
   $image->save($new2);
   
$con = mysql_connect("localhost","appma" ,"database");
	mysql_select_db("162_appma", $con);
$sql="INSERT INTO  gallery VALUES ('$img3', '$_POST[caption2]', '$_POST[date2]', '$_POST[event2]')";
mysql_query($sql,$con);   
}


if($c>0)
{
$new="thumb/";
$new.=$img5;
   
   $image->load($img4);
   $image->resize(245,164);
   $image->save($new);
   
   
$con = mysql_connect("localhost","appma" ,"database");
	mysql_select_db("162_appma", $con);
$sql="INSERT INTO  gallery VALUES ('$img5', '$_POST[caption3]', '$_POST[date3]', '$_POST[event3]')";
mysql_query($sql,$con);

  
}
?>

</body>
</html>